import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        name: 'index',
        component: () => import('@/pages/myManage.vue'),
        meta: {
            title: '个人中心'
        }
    },
    {
        path: '/login',
        name: 'login',
        meta: {
            title: '登录'
        },
        component: () => import('@/pages/login.vue'),
    },
   
    // 公司注册
    {
        path: '/companyRegistry',
        name: 'companyRegistry',
        meta: {
            title: '公司注册_合肥鑫山财务管理有限公司'
        },
        component: () => import('@/pages/companyRegistry.vue'),
    },

    // 我的页面  路由信息表
    {
        path: '/myManage',
        name: 'myManage',
        meta: {
            title: '个人中心'
        },
        component: () => import('@/pages/myManage.vue'),
    },
    {
        path: '/commissioner',
        name: 'commissioner',
        meta: {
            title: '个人资料'
        },
        component: () => import('@/pages/commissioner.vue')
    },
    {
        path: '/balance',
        name: 'balance',
        meta: {
            title: '账户余额'
        },
        component: () => import('@/pages/balance.vue')
    }, 
    {
        path: '/unit',
        name: 'unit',
        meta: {
            title: '往来单位'
        },
        component: () => import('@/pages/unit.vue')
    }, 
    {
        path: '/companyData',
        name: 'companyData',
        meta: {
            title: '公司资料'
        },
        component: () => import('@/pages/companyData.vue')
    }, 
    
    {
        path: '/companyRules',
        name: 'companyRules',
        meta: {
            title: '公司章程'
        },
        component: () => import('@/pages/companyRules.vue')
    }, 
    {
        path: '/resolutions',
        name: 'resolutions',
        meta: {
            title: '股东会决议'
        },
        component: () => import('@/pages/resolutions.vue')
    }, 
    {
        path: '/license',
        name: 'license',
        meta: {
            title: '营业执照扫描件'
        },
        component: () => import('@/pages/license.vue')
    }, 

    {
        path: '/express',
        name: 'express',
        meta: {
            title: '快递寄出'
        },
        component: () => import('@/pages/express.vue')
    }, 

    // 开票申请
    {
        path: '/application',
        name: 'application',
        meta: {
            title: '开票申请'
        },
        component: () => import('@/pages/application.vue')
    },
    {
        path: '/fillBill',
        name: 'fillBill',
        meta: {
            title: '填写开票信息'
        },
        component: () => import('@/pages/fillBill.vue')
    },
    {
        path: '/addBuyer',
        name: 'addBuyer',
        meta: {
            title: '发票抬头'
        },
        component: () => import('@/pages/addBuyer.vue')
    },
    {
        path: '/buyers',
        name: 'buyers',
        meta: {
            title: '发票抬头'
        },
        component: () => import('@/pages/buyers.vue')
    },
    // 财务数据上传
    {
        path: '/upload',
        name: 'upload',
        meta: {
            title: '财务数据上传'
        },
        component: () => import('@/pages/upload.vue')
    },
    // 财税报表
    {
        path: '/financialSheet',
        name: 'financialSheet',
        meta: {
            title: '财税报表'
        },
        component: () => import('@/pages/financialSheet.vue')
    },
    // 财务数据
    {
        path: '/financialData',
        name: 'financialData',
        meta: {
            title: '财务数据'
        },
        component: () => import('@/pages/financialData.vue')
    },
    // 我的发票抬头
    {
        path: '/invoiceTitle',
        name: 'invoiceTitle',
        meta: {
            title: '我的发票抬头'
        },
        component: () => import('@/pages/invoiceTitle.vue')
    },

];

const router = new VueRouter({
    routes,
    mode: 'hash',
    scrollBehavior() {
        return {
            x: 0,
            y: 0
        }
    },
    linkExactActiveClass: 'my_active'
});

//跳转前拦截
router.beforeEach((to, from, next) => {
    //设置title
    if (to.meta.title) {
        document.title = to.meta.title;
    }
    next();
});

//跳转后拦截
router.afterEach(() => {

});
export default router;